#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<int> missingTwo(vector<int>& nums) {
        int a = 0;
        for (int i = 1; i <= nums.size() + 2; i++) a ^= i;
        for (auto i : nums) a ^= i;
        int b = a & (-a);
        int c = 0, d = 0;
        for (int i = 1; i <= nums.size() + 2; i++)
        {
            int r = b & i;
            if (r) c ^= i;
            else d ^= i;
        }
        for (auto i : nums)
        {
            int r = b & i;
            if (r) c ^= i;
            else d ^= i;
        }
        return { c, d };
    }
};